<?php
/**
 * Aero - Xistins Technologies PHP Framework
 * 
 * LICENSE
 * This source file is subject to the New BSD license that is bundled 
 * with this package in the LICENSE.txt. It is also available through 
 * the world-wide-web at this URL: http://dev.xistins.com/license/production
 * If you did not receive a copy of this license and are unable to obtain
 * it through the world-wide-web, please send an email to 
 * license@xistins.com so we can send you a copy immediately.
 * 
 * @category   Aero
 * @package    Aero_Db
 * @subpackage Statement
 * @copyright  http://dev.xistins.com/license/production     New BSD
 * @version    $Id: Statement.php 2 2009-11-03 04:10:03Z csouth@xistins.com $
 */

/**
 * Abstract database adapter
 * 
 * @category   Aero
 * @package    Aero_Db
 * @subpackage Statement
 * @copyright  http://dev.xistins.com/license/production     New BSD
 * @version    $Id: Statement.php 2 2009-11-03 04:10:03Z csouth@xistins.com $
 */
abstract class Aero_Db_Statement
{
    /**
     * Database Adapter
     * @var Aero_Db_Adapter
     */
    protected $_adapter;

    /**
     * Query
     * @var string
     */
    protected $_query;

    /**
     * @var resource|object The driver level statement object/resource
     */
    protected $_stmt = null;

    /**
     * Statement Constructor
     * 
     * @param  Aero_Db_Adapter $adapter
     * @param  string $query
     * @return void 
     */
    public function __construct($adapter, $query)
    {
        $this->_adapter = $adapter;
        $this->_query   = $query;
    }

    /**
     * Fetch result
     * 
     * @return StdClass
     */
    public function fetch()
    {
        return $this->_fetch();
    }

    /**
     * Fetch all results
     * 
     * @return StdClass
     */
    public function fetchAll()
    {
        return $this->_fetchAll();
    }

    /**
     * Get the adapter object assigned to the statement
     * 
     * @return Aero_Db_Adapter
     */
    public function getAdapter()
    {
        return $this->_adapter;
    }

    /**
     * Run query
     * 
     * @return bool
     */
    public function execute()
    {
        return $this->_execute();
    }
}